<template>
	<view class="main">
		<header-vue :back="true" title="家庭合约"></header-vue>
		<view class="flex center order-type select-box font30">
			<view class="item" v-for="(item, index) in orderType" :class="{active: orderIndex == index}" @click="orderIndex = index">{{item}}</view>
		</view>
		<view v-for="item in 10" :key="item" class="white-box margin32" style="margin-top: 28rpx;" @click="goPage('/views/mine/detail')">
			<view class="flex between store-title font24">
				<view>订单编号：1331215413256</view>
				<view class="order-status">服务中</view>
			</view>
			<view class="flex start">
				<image :src="IMAGE_URL + '/static/login/bg.png'"></image>
				<view class="flex column between start store-info">
					<view style="display: grid;">
						<view class="font28 fontbold-500 ellipsis" style="width: 100%;">空调清洗高温除尘菌让呼吸更清新空调清洗高温除尘菌让呼吸更清新</view>
						<view class="sale-num font24">已选：日常保洁2小时</view>
					</view>
					<view class="flex price">
						<text class="font24">￥</text>
						<text class="font28">45</text>
						<text class="font20">/60分钟</text>
					</view>
				</view>
			</view>
			<view class="flex order-btn font28 fontbold-500">
				<view class="flex btn-2">师傅信息</view>
			</view>		
		</view>
		<u-popup :show="showFilter" mode="bottom" @close="showFilter = false" :round="28">
			<view class="flex modal-title">
				<view class="flex font36 fontbold-500">全部筛选</view>
				<i class="iconfont icon-close font32" @click="showFilter = false"></i>
			</view>
			<view class="modal-content margin32">
				<view class="sub-titile font30 fontbold-500">价格区间</view>
				<view class="flex start checkbox-box">
					<view class="flex column checkbox" v-for="item in priceBetween" :key="item.name" :class="{active: item.name === params.price }">
						<view class="font28">{{item.name}}</view>
						<view class="font24">{{item.des}}</view>
					</view>
				</view>
				<view class="flex between input-group">
					<input placeholder="自定义最低价"/>
					<view class="line"></view>
					<input placeholder="自定义最高价"/>
				</view>
				<view class="sub-titile font30 fontbold-500">品牌</view>
				<view class="flex start checkbox-box">
					<view class="flex column checkbox" v-for="item in priceBetween" :key="item.name" :class="{active: item.name === params.price }">
						<view class="font28">{{item.name}}</view>
						<view class="font24">{{item.des}}</view>
					</view>
				</view>
			</view>
			<view class="flex modal-footer font36 fontbold-500">
				<view class="flex clear-btn" @click="showFilter = false">清空选择</view>
				<view class="flex submit-btn" @click="showFilter = false">确定</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import headerVue from '../../components/header.vue';
	import appConfig from '@/config/app.js'
	export default {
		components: {
			headerVue
		},
		data() {
			return {
				IMAGE_URL: appConfig.IMAGE_URL,
				imageUrl: '~@static/shop/',
				typeIndex: 0,
				orderIndex: 0,
				orderType: ['服务中', '已完成'],
				selectShow: false,
				showFilter: false,
				params: {
					keyword: '',
					type: ''
				}
			}
		},
		methods: {
			goPage(url) {
			    uni.navigateTo({ url });
			},
		}
	}
</script>

<style lang="scss" scoped>
	.main {
		background: #F6F6F6;
	}
	
	.margin32 {
		margin: 0 32rpx;
	}
	
	.search-box {
		height: 72rpx;
		background: $uni-bg-color;
		border-radius: 60rpx;
		padding: 0 28rpx;
		margin-bottom: 28rpx;
		width: 100%;
		
		.iconfont {
			color: $uni-text-color-grey;
			margin-right: 20rpx;
		}
		
		.input {
			width: 100%;
			height: 100%;
			color: $uni-text-color-grey;
		}
	}
	
	.price {
		color: $uni-text-color-red;
		align-items: baseline;
	}
	
	.select-box {
		position: relative;
		background: $uni-bg-color;
		box-sizing: border-box;
	}
	
	.order-type {
		padding: 20rpx 32rpx;
		
		.item {
			color: $uni-text-color-grey1;
			height: 42rpx;
			position: relative;
			margin-left: 160rpx;
			
			&:nth-child(1) {
				margin-left: 0;
			}
		}
		
		.active {
			font-weight: 500;
			font-size: 32rpx;
			color: $uni-text-color;
			
			&:before {
				content: '';
				width: 32rpx;
				height: 6rpx;
				background: #0785CF;
				border-radius: 20rpx;
				position: absolute;
				bottom: -20rpx;
				left: 50%;
				transform: translate(-50%, 0);
			}
		}
	}
	
	.white-box {
		background: $uni-bg-color;
		box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(0,0,0,0.1);
		border-radius: 20rpx;
		padding: 28rpx;
		box-sizing: border-box;
		margin-bottom: 28rpx;
		
		.store-title {
			padding-bottom: 28rpx;
			border-bottom: 1rpx solid #DDDDDD;
			margin-bottom: 28rpx;
			color: $uni-text-color-grey1;
		}
		
		.order-status {
			color: #DF9824;
		}
		
		image {
			width: 160rpx;
			height: 160rpx;
			border-radius: 20rpx;
			margin-right: 18rpx;
			flex-shrink: 0;
		}
		
		.store-info {
			height: 160rpx;
			flex: 1;
			width: 0;
			align-items: flex-start;
			
			.sale-num {
				color: $uni-text-color-grey;
				margin-top: 12rpx;
			}
			
			.icon-comment {
				margin-left: 26rpx;
			}
		}
		
		.order-btn {
			margin-top: 28rpx;
			color: $uni-text-color-inverse;
			justify-content: flex-end;
			
			.btn-1 {
				width: 160rpx;
				height: 56rpx;
				background: #DF9824;
				border-radius: 100rpx;
				margin-right: 28rpx;
			}
			
			.btn-2 {
				width: 160rpx;
				height: 56rpx;
				background: #0785CF;
				border-radius: 100rpx;
			}
		}
	}
	
	.modal-title {
		margin: 40rpx 0;
		
		.icon-close {
			position: absolute;
			right: 32rpx;
			top: 50rpx;
		}
	}
	
	.modal-content {
		
		.checkbox-box {
			flex-wrap: wrap;
			
			.checkbox {
				width: calc((100% - 36rpx) / 3);
				height: 86rpx;
				background: #F5F5F5;
				border-radius: 100rpx;
				margin-top: 40rpx;
				margin-right: 18rpx;
				
				&:nth-child(3n) {
					margin-right: 0;
				}
				
				.font24 {
					color: $uni-text-color-grey;
					margin-top: 4rpx;
				}
			}
			
			.active {
				background: #FFEFD5;
			}
		}
		
		.input-group {
			height: 86rpx;
			background: #F5F5F5;
			border-radius: 60rpx;
			margin: 40rpx 0 54rpx;
			
			.line {
				width: 40rpx;
				height: 1rpx;
				background: $uni-text-color-grey;
			}
			
			input {
				text-align: center;
			}
		}
	}
	
	.modal-footer {
		color: $uni-text-color-inverse;
		margin: 40rpx 0 calc(env(safe-area-inset-bottom) + 20rpx) 0;
		
		.clear-btn {
			width: 260rpx;
			height: 80rpx;
			background: #DF9824;
			box-shadow: 0rpx 6rpx 12rpx 0rpx rgba(223,152,36,0.3);
			border-radius: 100rpx;
		}
		
		.submit-btn {
			width: 260rpx;
			height: 80rpx;
			background: #0785CF;
			box-shadow: 0rpx 6rpx 12rpx 0rpx rgba(7,133,207,0.3);
			border-radius: 100rpx 100rpx 100rpx 100rpx;
			margin-left: 60rpx;
		}
	}
</style>
